package org.skyemoon.hbase.hbasetest.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.skyemoon.hbase.hbasetest.dao.entity.RadioDO;
import org.skyemoon.hbase.hbasetest.dao.mapper.RadioMapper;
import org.skyemoon.hbase.hbasetest.dto.req.FlightImageReqDTO;
import org.skyemoon.hbase.hbasetest.service.RadioService;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
@RequiredArgsConstructor
public class RadioServiceImpl extends ServiceImpl<RadioMapper, RadioDO> implements RadioService {

    private final RadioMapper radioMapper;

    @Override
    public void saveRadioData(List<RadioDO> radioDOList) {
        this.saveBatch(radioDOList);
    }

    @Override
    public List<RadioDO> selectRadioData(FlightImageReqDTO requestParam) {
        LambdaQueryWrapper<RadioDO> queryWrapper = Wrappers.lambdaQuery(RadioDO.class)
                .eq(RadioDO::getFlightType, requestParam.getFlightType())
                .eq(RadioDO::getFlightNum, requestParam.getFlightNum())
                .eq(RadioDO::getFlightTask, requestParam.getFlightTask());
        return radioMapper.selectList(queryWrapper);
    }
}
